package com.sskj.bibi.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.bibi.bean.RecordHistoryBean;
import com.sskj.bibi.ui.fragment.HistoryEntrustFragment;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;

import java.util.List;

import io.reactivex.Flowable;


public class HistoryEntrustFragmentPresenter extends BasePresenter<HistoryEntrustFragment> {

    public Flowable<List<RecordHistoryBean>> getEntrustHistoryFlow(String p, String size, String code, String type) {


        return httpService.getRecordHistory(p, size, code, type)
                .converter(new JsonConverter<HttpData<PageBean<RecordHistoryBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList());
    }


}
